<%-- 
    Document   : header
    Created on : Mar 20, 2012, 12:41:06 PM
    Author     : Julien
--%>

<%@page import="java.util.ResourceBundle"%>
<%@page import="java.util.Locale"%>
<%@page import="application.beans.SectionBean"%>
<%@page import="java.util.List"%>
<%@page import="controleur.ConstantesWeb"%>
<%@page import="application.beans.CompteBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%  
    List<SectionBean> sections = (List<SectionBean>)(session.getAttribute(ConstantesWeb.ATTRIBUT_LISTE_SECTIONS));
    pageContext.setAttribute(ConstantesWeb.ATTRIBUT_LISTE_SECTIONS, sections);
    
    // On va chercher le compte utilisateur, qu'il soit connecté ou non
    CompteBean utilisateur = (CompteBean)session.getAttribute(ConstantesWeb.ATTRIBUT_UTILISATEUR);
    pageContext.setAttribute(ConstantesWeb.ATTRIBUT_UTILISATEUR, utilisateur);
    
    String idBackground = (String)session.getAttribute(ConstantesWeb.ATTRIBUT_ID_BACKGROUND);
%>

<input type="hidden" id="idBackground" name="<%=ConstantesWeb.ATTRIBUT_ID_BACKGROUND%>" value="<%=idBackground%>">
<div id="bg-select">
    <ol>
        <li><img id="bg0" src="Images/select-bg0.gif" class="imgBackground"/></li>
        <li><img id="bg1" src="Images/select-bg1-red.gif" class="imgBackground"/></li>
        <li><img id="bg2" src="Images/select-bg1-green.gif" class="imgBackground"/></li>
        <li><img id="bg3" src="Images/select-bg1-blue.gif" class="imgBackground"/></li>
        <li><img id="bg4" src="Images/select-bg1-teal.gif" class="imgBackground"/></li>
        <li><img id="bg5" src="Images/select-bg1-gray.gif" class="imgBackground"/></li>
        <li><img id="bg6" src="Images/select-bg2-red.gif" class="imgBackground"/></li>
        <li><img id="bg7" src="Images/select-bg2-green.gif" class="imgBackground"/></li>
        <li><img id="bg8" src="Images/select-bg2-blue.gif" class="imgBackground"/></li>
        <li><img id="bg9" src="Images/select-bg2-teal.gif" class="imgBackground"/></li>
        <li><img id="bg10" src="Images/select-bg2-gray.gif" class="imgBackground"/></li>
        <li><img id="bg11" src="Images/select-bg3-red.gif" class="imgBackground"/></li>
        <li><img id="bg12" src="Images/select-bg3-green.gif" class="imgBackground"/></li>
        <li><img id="bg13" src="Images/select-bg3-blue.gif" class="imgBackground"/></li>
        <li><img id="bg14" src="Images/select-bg3-teal.gif" class="imgBackground"/></li>
        <li><img id="bg15" src="Images/select-bg3-gray.gif" class="imgBackground"/></li>
        <li><img id="bg16" src="Images/select-bg4-red.gif" class="imgBackground"/></li>
        <li><img id="bg17" src="Images/select-bg4-green.gif" class="imgBackground"/></li>
        <li><img id="bg18" src="Images/select-bg4-blue.gif" class="imgBackground"/></li>
        <li><img id="bg19" src="Images/select-bg4-teal.gif" class="imgBackground"/></li>
        <li><img id="bg20" src="Images/select-bg4-gray.gif" class="imgBackground"/></li>
        <li><img id="bg21" src="Images/select-bg5-red.gif" class="imgBackground"/></li>
        <li><img id="bg22" src="Images/select-bg5-green.gif" class="imgBackground"/></li>
        <li><img id="bg23" src="Images/select-bg5-blue.gif" class="imgBackground"/></li>
        <li><img id="bg24" src="Images/select-bg5-teal.gif" class="imgBackground"/></li>
        <li><img id="bg25" src="Images/select-bg5-gray.gif" class="imgBackground"/></li>
    </ol>
</div>
<div id="tete">
    <div id="logo">
    </div>
    <div id="login">
    <%if(utilisateur == null){%>
    <form id="formLogin" action="./Login" method="post">
        <input type="hidden" name="<%=ConstantesWeb.PARAM_NEXT%>" value="<%=ConstantesWeb.ATTRIBUT_SERV_ACCUEIL%>"/>
        <table>
            <thead>
                <tr>
                    <td class="fullWidth" colspan="2"><%= strings.getString("AccueilConnexion") %></td>
                </tr>
            </thead>
            <tbody>
                <tr><td colspan="2"><em><%if(session.getAttribute(ConstantesWeb.ATTRIBUT_ERREUR_LOGIN) != null){%><%=session.getAttribute(ConstantesWeb.ATTRIBUT_ERREUR_LOGIN)%><%}%>&nbsp;</em></td></tr>
                <tr>
                    <td><%= strings.getString("AccueilUtilisateur") %></td>
                    <td>
                        <input type="text" id="nomUtilisateur" class="txtLogin" name="<%=ConstantesWeb.PARAM_USERNAME%>"/>
                    </td>
                </tr>
                <tr>
                    <td><%= strings.getString("AccueilMotDePasse") %></td>
                    <td>
                        <input type="password" id="motDePasse" class="txtLogin" name="<%=ConstantesWeb.PARAM_PASSWORD%>"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2"><input type="submit" class="btnLogin" id="btnConnexion" value="<%= strings.getString("AccueilConnecter") %>"/></td>
                </tr>
            </tbody>
        </table>
    </form>
    <%}else{%>
    <table>
        <thead>
            <tr>
                <td class="fullWidth" colspan="2"><%=utilisateur.getNomComplet()%></td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><%= strings.getString("AccueilNouveau") %> </td>
                <td><%=utilisateur.compterMessagesNonLus()%></td>
            </tr>
            <tr>
                <td colspan="2">
                    <form id="formCompte" action="./ServCompte" method="post">
                        <input type="submit" class="btnLogin" id="btnAccederCompte" value="<%= strings.getString("AccueilAcces") %>"/>
                    </form>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <form id="formDeconnection" action="./Deconnection" method="post">
                        <input type="hidden" name="<%=ConstantesWeb.PARAM_NEXT%>" value="<%=ConstantesWeb.ATTRIBUT_SERV_ACCUEIL%>"/>
                        <input type="submit" class="btnLogin" id="btnDeconnection" value="<%= strings.getString("AccueilDeconnecter") %>"/>
                    </form>
                </td>
            </tr>
        </tbody>
    </table>
    <%}%>
    </div>
    <div class="searchbar">
        <form action="./Recherche" method="get">
            <input type="text" name="<%= ConstantesWeb.PARAM_STRING_RECHERCHE %>"/>
            <%-- <input type="hidden" name="<%= ConstantesWeb.PARAM_TYPE_RECHERCHE %>" value="<%= ConstantesWeb.PARAM_RECHERCHE_TEXTE %>"/> --%>
            <img src="Images/search-button.png"/>
        </form>
    </div>     
</div>                
